package com.yanqu.road.server.cmd.activity.huashigang;

import com.yanqu.road.entity.player.UserBaseInfo;
import com.yanqu.road.logic.pb.PlayerBasePb;
import com.yanqu.road.pb.huashigang.HuaShiGangProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.cross.battle.HuaShiGangMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.CrossProtocol;

import java.util.List;

@Cmd(code = CrossProtocol.C2_HUA_SHI_GANG_AUTO_HANDLE_NEXT_POINT, desc = "自动处理下个点")
public class CrossAutoHandleNextPointCmd extends CrossCommand {

    int x;
    int y;
    int activityId;
    List<Integer> patronsList;
    int goldenKeyNum;
    UserBaseInfo userBaseInfo;
    List<Long> abilityList;
    List<Integer> additionList;
    long totalAbility;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        HuaShiGangProto.CrossAutoHandleNextPointReqMsg msg = HuaShiGangProto.CrossAutoHandleNextPointReqMsg.parseFrom(packet.getBytes());
        x = msg.getX();
        y = msg.getY();
        activityId = msg.getActivityId();
        patronsList = msg.getPatronsIdList();
        goldenKeyNum = msg.getGoldenKeyNum();
        userBaseInfo = PlayerBasePb.parseToUserBaseInfo(msg.getPlayerBaseInfo());
        abilityList = msg.getPatronsAbilityList();
        additionList = msg.getPatronsAdditionList();
        totalAbility = msg.getTotalAbility();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        HuaShiGangMgr.autoHandleNextPoint(activityId, serverId, packet.getPlayerId(), x, y, goldenKeyNum, userBaseInfo,
                patronsList, abilityList, additionList, totalAbility);
    }

    @Override
    public void sendData() {

    }
}
